<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>取得与给定颜色最接近的色度的黑白色的索引</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.imagecolorclosesthwb" class="refentry">
   <div class="refnamediv"> <h1 class="refname">imagecolorclosesthwb</h1>
    <p class="verinfo">(PHP 4 &gt;= 4.0.1, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imagecolorclosesthwb</span> &mdash; <span class="dc-title">
     取得与给定颜色最接近的色度的黑白色的索引
    </span></p>

   </div>
 <div class="refsect1 description" id="refsect1-function.imagecolorclosesthwb-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagecolorclosesthwb</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$red</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$green</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$blue</code></span>
   ) : <span class="type">int</span></div>

  <p class="para rdfs-comment">
   取得与给定颜色最接近的色度的黑白色的索引。
  </p>
   </div>

 <div class="refsect1 parameters" id="refsect1-function.imagecolorclosesthwb-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    <dt>
<code class="parameter">image</code></dt>

<dd>
<p class="para">由图象创建函数(例如<span class="function"><a href="imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a></span>)返回的图象资源。</p></dd>

    
     <dt>
<code class="parameter">red</code></dt>

     <dd>

      <p class="para">红色成分的值。</p>
     </dd>

    
    
     <dt>
<code class="parameter">green</code></dt>

     <dd>

      <p class="para">绿色成分的值。</p>
     </dd>

    
    
     <dt>
<code class="parameter">blue</code></dt>

     <dd>

      <p class="para">蓝色成分的值。</p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagecolorclosesthwb-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回一个整数，是给定颜色最接近的色度的黑白色的索引。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.imagecolorclosesthwb-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3666">
    <p><strong>Example #1 使用 <span class="function"><strong>imagecolorclosesthwb()</strong></span> 的例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$im&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefromgif</span><span style="color: #007700">(</span><span style="color: #DD0000">'php.gif'</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">'HWB:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">imagecolorclosesthwb</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">116</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">115</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">152</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
HWB: 33
</pre></div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 changelog" id="refsect1-function.imagecolorclosesthwb-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.3.0</td>
       <td>
         在 Windows 平台上可用
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.imagecolorclosesthwb-seealso">
   <h3 class="title">参见</h3>
   <p class="para">
    <ul class="simplelist">
     <li class="member"><span class="function"><a href="imagecolorclosest.html" class="function" rel="rdfs-seeAlso">imagecolorclosest()</a> - 取得与指定的颜色最接近的颜色的索引值</span></li>
    </ul>
   </p>
  </div>

  </div></div></div></body></html>